"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
//抽象类
var AbsrtractDrink = /** @class */ (function () {
    function AbsrtractDrink() {
    }
    return AbsrtractDrink;
}());
;
var CoCola = /** @class */ (function (_super) {
    __extends(CoCola, _super);
    function CoCola() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    CoCola.prototype.getPrice = function () {
        return 3;
    };
    return CoCola;
}(AbsrtractDrink));
var CoFe = /** @class */ (function (_super) {
    __extends(CoFe, _super);
    function CoFe() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    CoFe.prototype.getPrice = function () {
        return 5;
    };
    return CoFe;
}(AbsrtractDrink));
;
var Customer = /** @class */ (function () {
    function Customer() {
    }
    Customer.prototype.drink = function (abtractDrink) {
        console.log('花费', abtractDrink.getPrice());
    };
    return Customer;
}());
;
//里氏替换  可以用子类替换用父类的地方，他是一个原则，要求子类不能违反父类的规定和功能
var c1 = new Customer();
// c1.drink(new AbsrtractDrink())
c1.drink(new CoCola());
c1.drink(new CoFe());
